<?php

namespace App\Http\Requests\V3_2_7;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class AddBillsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'mess_board_id' => 'required|integer|min:1',//留言内容表id
            'goods_info' => 'required|json',//选择的标签名称
            'req_type' => ['required',Rule::in([0, 1])]
        ];

    }

    /**
     * 验证错误信息.
     *
     * @return array
     */
    public function messages(): array
    {
        return [
            'mess_board_id.required' => '内容表`主键`，不能为空！',
            'mess_board_id.integer' => '内容表`主键`为整数！',
            'mess_board_id.min' => '内容表`主键`最小值为1',
            'goods_info.required' => '请选择商品！',
            'goods_info.json' => '商品数据类型为Json！',
            'req_type.required' => '请求类型必传！',
            'req_type.in' => '请求类型错误',
        ];
    }
}
